﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using THE_WIND_RISES.Common.Domans.Produce.Customers;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace SlaughterItem.Common.Infrastructures.Interfaces
{
    /// <summary>
    /// 基类仓储接口  where约束，可以被实例化
    /// </summary>
    /// <typeparam name="T">占位符</typeparam>
    public interface IBaseRepository<T> where T : class, new()
    {
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        IEnumerable<T> GetAll(string sql,object param=null);
        /// <summary>
        /// 新增
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        int Add(string sql, object param);

        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        int AddRound(string sql, object param);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        int Update(string sql, object? Data);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        int Delete(string sql,object? Data);
        /// <summary>
        /// 事务操作
        /// </summary>
        /// <param name="SqlList"></param>
        /// <param name="Data"></param>
        /// <returns></returns>
        int AffairCRUD(List<string> SqlList, object? Data=null);
    }
}
